# 合数个数
import math

def count_num(n):
    def sieve(n):
        is_prime = [True] * (n + 1)
        is_prime[0] = is_prime[1] = False
        for i in range(2, int(math.sqrt(n)) + 1):
            if is_prime[i]:
                for j in range(i * i, n + 1, i):
                    is_prime[j] = False
        return [prime for prime, is_p in enumerate(is_prime) if is_p]

    primes = sieve(n)
    prime_num = len(primes)
    return n - prime_num - 1  # 1也不是合数


if __name__ == "__main__":
    print(count_num(2020))
